﻿using System.Collections.Generic;
using System.Linq;
using ZilLion.Service.Core.DapperWrapper;
using ZilLion.Service.Core.DapperWrapper.SqlServer;
using ZilLion.Service.WeChatMall.Domain.Entitys.GsInfo;
using ZilLion.Service.WeChatMall.Domain.Repositorys.Interface.GoodInfo;

namespace ZilLion.Service.WeChatMall.Domain.Repositorys.GoodInfo
{
    public class OfflineGsReponsitory : SqlServerRespository<OfflineGsEntity>,
        IOfflineGsReponsitory
    {
        public OfflineGsReponsitory()
        {
            Context = new WechatMallContext();
        }

        public IList<OfflineGsEntity> GetAll()
        {
            return GetAll().ToList();
        }

        public IList<OfflineGsEntity> GetImportableGs(string zlcompanykey)
        {
            var querysql = DapperHelper.CreateColSqlByMap<OfflineGsEntity>();
            var list = GetList($@"SELECT {querysql} FROM  waibkyhpa 
            WHERE hpid NOT IN (SELECT offlinegsid FROM  offlinegsrelationship 
            WHERE zlcompanykey=@zlcompanykey)", new {zlcompanykey}).ToList();
            return list;
        }
    }
}